package com.flymobi.adapter;

import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.flymobi.sun.R;

public class ListAdapter extends BaseAdapter {
	Context mContext;
	private String data[] ;
	
	public ListAdapter(Context context,String [] data) {
		this.mContext = context;
		this.data=data;
	}
	public int getCount() {
		// TODO Auto-generated method stub
		return data.length;
	}

	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder viewHolder = new ViewHolder();
		convertView = LayoutInflater.from(mContext).inflate(
				R.layout.zixun_item, null);
		viewHolder.zixun_text = (TextView) convertView
				.findViewById(R.id.zixun_Text);
		viewHolder.call = (ImageView) convertView.findViewById(R.id.call);
		viewHolder.text = (TextView) convertView.findViewById(R.id.text);
		if (position % 2 == 0) {
			// convertView.setBackgroundColor(0xaafefefe);#f6f5ec
			convertView.setBackgroundColor(Color.WHITE);
		}
		viewHolder.zixun_text.setText(data[position]);
		return convertView;
	}

	class ViewHolder {
		TextView zixun_text,text;
		ImageView call;
	}
}
